Skip to content

feat(workflow): Backlog management bot #11518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SamuelFialka
Copy link

@SamuelFialka SamuelFialka commented Jun 25, 2025

Description of Change

This PR introduces a GitHub Action workflow that helps manage stale issues in the repository.
The bot runs daily and performs the following tasks:

  • Skips pull requests and issues labeled as to-be-discussed
  • Automatically closes issues labeled awaiting-response or those without assignees after 90+ days of inactivity
  • Sends a reminder comment on assigned issues that have been inactive for over 90 days (without re-sending it more than once a week)
  • Avoids duplicate comments and respects special labels
  • Moves issues labeled 'questions' to GitHub Discussions

The purpose of this automation is to keep the issue backlog clean, manageable, and up-to-date.
Feel free to suggest adjustments to label logic, thresholds, or wording in comments.

Tests scenarios

The script and workflow were successfully tested on GitHub Issues in my own fork. Behavior such as issue closure and reminder comments worked as expected.

Related links

Please provide links to related issue, PRs etc.

(eg. Closes #number of issue)

@SamuelFialka SamuelFialka requested a review from lucasssvaz as a code owner June 25, 2025 11:32
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Samuel Fialka seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

github-actions bot commented Jun 25, 2025

Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello SamuelFialka, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against f409eb2

@lucasssvaz lucasssvaz requested a review from Copilot June 25, 2025 12:28
Copilot

This comment was marked as outdated.

@lucasssvaz lucasssvaz added the Type: CI & Testing Related to continuous integration, automated testing, or test infrastructure. label Jun 25, 2025
@P-R-O-C-H-Y P-R-O-C-H-Y added the Status: Review needed Issue or PR is awaiting review label Jun 27, 2025
@lucasssvaz lucasssvaz requested a review from Copilot July 30, 2025 21:42
@lucasssvaz lucasssvaz added the Status: Pending CLA ⚠️ Contributor is required to sign the CLA label Jul 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an automated GitHub Actions workflow for managing stale issues in the repository backlog. The bot runs daily to keep issues organized and up-to-date by handling different types of inactive issues.

Key changes:

  • Adds a daily scheduled workflow that processes open issues older than 90 days
  • Automatically closes issues with specific labels or without assignees
  • Sends reminder comments to assigned issues and migrates questions to discussions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/backlog-bot.yml Defines the GitHub Actions workflow that runs daily and executes the cleanup script
.github/scripts/backlog-cleanup.js Contains the main logic for processing issues, sending reminders, closing stale issues, and migrating questions to discussions

owner,
repo,
issue_number: issue.number,
per_page: 10,
Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using per_page: 10 when checking for recent comments is inefficient. Since you're only looking for recent 'Friendly Reminder' comments from github-actions[bot], consider using per_page: 100 or at least 50 to reduce API calls, especially for issues with many comments.

Suggested change
per_page: 10,
per_page: 50,

Copilot uses AI. Check for mistakes.

async function migrateToDiscussion(github, owner, repo, issue) {
const discussionCategory = 'Q&A';

const { data: categories } = await github.rest.discussions.listCategories({
Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The discussion categories are fetched for every issue that needs migration. Consider fetching categories once at the beginning of the script and reusing the result to avoid redundant API calls.

Copilot uses AI. Check for mistakes.

owner,
repo,
title: issue.title,
body: `Originally created by @${issue.user.login} in #${issue.number}\n\n---\n\n${issue.body}`,
Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue body could be null or undefined, which would result in 'undefined' being appended to the discussion body. Add a null check: ${issue.body || ''} or similar handling.

Suggested change
body: `Originally created by @${issue.user.login} in #${issue.number}\n\n---\n\n${issue.body}`,
body: `Originally created by @${issue.user.login} in #${issue.number}\n\n---\n\n${issue.body || ''}`,

Copilot uses AI. Check for mistakes.

Comment on lines +132 to +148
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: issue.number,
per_page: 10,
});

const recentFriendlyReminder = comments.find(comment =>
comment.user.login === 'github-actions[bot]' &&
comment.body.includes('⏰ Friendly Reminder') &&
(now - new Date(comment.created_at)) < sevenDays
);
if (recentFriendlyReminder) {
totalSkipped++;
continue;
}

Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are fetched for every issue that meets the age threshold, even if the issue will be closed or skipped due to exempt labels. Consider checking exempt labels and close conditions before fetching comments to reduce unnecessary API calls.

Suggested change
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: issue.number,
per_page: 10,
});
const recentFriendlyReminder = comments.find(comment =>
comment.user.login === 'github-actions[bot]' &&
comment.body.includes('⏰ Friendly Reminder') &&
(now - new Date(comment.created_at)) < sevenDays
);
if (recentFriendlyReminder) {
totalSkipped++;
continue;
}

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C5000.000.00000.000.00
ESP32P4000.000.00000.000.00
ESP32S3000.000.00000.000.00
ESP32S2000.000.00000.000.00
ESP32C3000.000.00000.000.00
ESP32C6000.000.00000.000.00
ESP32H2000.000.00000.000.00
ESP32000.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
EEPROM/examples/eeprom_class00--00--00000000
EEPROM/examples/eeprom_extra00--00--00000000
EEPROM/examples/eeprom_write00--00--00000000
ESP32/examples/AnalogOut/LEDCFade00--00--00000000
ESP32/examples/AnalogOut/LEDCGammaFade00--------0000--
ESP32/examples/AnalogOut/LEDCSingleChannel00--00--00000000
ESP32/examples/AnalogOut/LEDCSoftwareFade00--00--00000000
ESP32/examples/AnalogOut/SigmaDelta000000--00000000
ESP32/examples/AnalogOut/ledcFrequency000000--00000000
ESP32/examples/AnalogOut/ledcWrite_RGB000000--00000000
ESP32/examples/AnalogRead000000--00000000
ESP32/examples/AnalogReadContinuous0000000000000000
ESP32/examples/ArduinoStackSize0000000000000000
ESP32/examples/CI/CIBoardsTest0000000000000000
ESP32/examples/ChipID/GetChipID0000000000000000
ESP32/examples/DeepSleep/TimerWakeUp000000000000--00
ESP32/examples/FreeRTOS/BasicMultiThreading0000000000000000
ESP32/examples/FreeRTOS/Mutex0000000000000000
ESP32/examples/FreeRTOS/Queue0000000000000000
ESP32/examples/FreeRTOS/Semaphore0000000000000000
ESP32/examples/GPIO/BlinkRGB0000000000000000
ESP32/examples/GPIO/FunctionalInterrupt0000000000000000
ESP32/examples/GPIO/FunctionalInterruptLambda0000000000000000
ESP32/examples/GPIO/FunctionalInterruptStruct0000000000000000
ESP32/examples/GPIO/GPIOInterrupt0000000000000000
ESP32/examples/HWCDC_Events000000--000000--
ESP32/examples/MacAddress/GetMacAddress0000000000000000
ESP32/examples/RMT/Legacy_RMT_Driver_Compatible0000000000000000
ESP32/examples/RMT/RMTCallback0000000000000000
ESP32/examples/RMT/RMTLoopback0000000000000000
ESP32/examples/RMT/RMTReadXJT0000000000000000
ESP32/examples/RMT/RMTWrite_RGB_LED0000000000000000
ESP32/examples/RMT/RMT_CPUFreq_Test0000000000000000
ESP32/examples/RMT/RMT_EndOfTransmissionState0000000000000000
ESP32/examples/RMT/RMT_LED_Blink0000000000000000
ESP32/examples/ResetReason/ResetReason0000000000000000
ESP32/examples/ResetReason/ResetReason20000000000000000
ESP32/examples/Serial/BaudRateDetect_Demo0000000000000000
ESP32/examples/Serial/OnReceiveError_BREAK_Demo0000000000000000
ESP32/examples/Serial/OnReceive_Demo0000000000000000
ESP32/examples/Serial/RS485_Echo_Demo000000000000--00
ESP32/examples/Serial/RxFIFOFull_Demo000000000000--00
ESP32/examples/Serial/RxTimeout_Demo000000000000--00
ESP32/examples/Serial/Serial_All_CPU_Freqs000000000000--00
ESP32/examples/Serial/Serial_STD_Func_OnReceive000000000000--00
ESP32/examples/Serial/onReceiveExample000000000000--00
ESP32/examples/Template/ExampleTemplate000000000000--00
ESP32/examples/Time/SimpleTime000000000000----
ESP32/examples/Timer/RepeatTimer000000000000----
ESP32/examples/Timer/WatchdogTimer000000000000----
ESP32/examples/Utilities/HEXBuilder00--00000000----
ESP32/examples/Utilities/MD5Builder00--00000000----
ESP32/examples/Utilities/SHA1Builder00--00000000----
ESP_I2S/examples/ES8388_loopback00--0000--00----
ESP_I2S/examples/Simple_tone00--0000--00----
ESP_NOW/examples/ESP_NOW_Broadcast_Master00--0000--00----
ESP_NOW/examples/ESP_NOW_Broadcast_Slave00--0000--00----
ESP_NOW/examples/ESP_NOW_Network00----00--00----
ESP_NOW/examples/ESP_NOW_Serial00----00--00----
ESPmDNS/examples/mDNS-SD_Extended00----00--00----
ESPmDNS/examples/mDNS_Web_Server00----00--00----
Ethernet/examples/ETH_W5500_Arduino_SPI00----00--00----
Ethernet/examples/ETH_W5500_IDF_SPI00----00--------
Ethernet/examples/ETH_WIFI_BRIDGE00----00--------
Zigbee/examples/Zigbee_Pressure_Flow_Sensor00--------00----
Zigbee/examples/Zigbee_Range_Extender00--00000000--00
Zigbee/examples/Zigbee_Scan_Networks00--------00----
Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy00--------00----
Zigbee/examples/Zigbee_Temperature_Sensor00--------00----
Zigbee/examples/Zigbee_Thermostat00--000000000000
Zigbee/examples/Zigbee_Vibration_Sensor00--------0000--
Zigbee/examples/Zigbee_Wind_Speed_Sensor00--------0000--
Zigbee/examples/Zigbee_Window_Covering00--------0000--
ESP32/examples/DeepSleep/TouchWakeUp--000000------00
ESP32/examples/TWAI/TWAIreceive--0000000000--00
ESP32/examples/TWAI/TWAItransmit--0000000000--00
ESP32/examples/Touch/TouchInterrupt--000000--------
ESP32/examples/Touch/TouchRead--000000--------
WiFi/examples/WiFiTelnetToSerial--00------------
WiFi/examples/WiFiUDPClient--00------------
Wire/examples/WireMaster--00------------
Wire/examples/WireScan--00------------
Wire/examples/WireSlave--00------------
Wire/examples/WireSlaveFunctionalCallback--00------------
ESP32/examples/Camera/CameraWebServer (1)----0000------00
ESP32/examples/Camera/CameraWebServer (2)----0000------00
ESP32/examples/Camera/CameraWebServer (3)----00----------
ESP32/examples/DeepSleep/ExternalWakeUp----0000------00
ESP_I2S/examples/Record_to_WAV----00----------
Zigbee/examples/Zigbee_Analog_Input_Output----00----------
Zigbee/examples/Zigbee_Color_Dimmer_Switch----00--------00
Zigbee/examples/Zigbee_Electrical_AC_Sensor----00--00----00
Zigbee/examples/Zigbee_Electrical_AC_Sensor_MultiPhase----00--00----00
Zigbee/examples/Zigbee_Fan_Control----000000----00
Zigbee/examples/Zigbee_Gateway----000000----00
Zigbee/examples/Zigbee_On_Off_MultiSwitch----000000----00
Zigbee/examples/Zigbee_On_Off_Switch----000000----00
Zigbee/examples/Zigbee_Power_Outlet----00000000--00
FFat/examples/FFat_Test------00--------
BLE/examples/iBeacon--------00--00--
DNSServer/examples/CaptivePortal--------00----00
BluetoothSerial/examples/DiscoverConnect--------------00
BluetoothSerial/examples/GetLocalMAC--------------00
BluetoothSerial/examples/SerialToSerialBT--------------00
BluetoothSerial/examples/SerialToSerialBTM--------------00
BluetoothSerial/examples/SerialToSerialBT_Legacy--------------00
BluetoothSerial/examples/SerialToSerialBT_SSP--------------00
BluetoothSerial/examples/bt_classic_device_discovery--------------00
BluetoothSerial/examples/bt_remove_paired_devices--------------00
ESP32/examples/DeepSleep/SmoothBlink_ULP_Code--------------00


on:
schedule:
- cron: '0 2 * * *' # Run daily at 2 AM UTC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to avoid clashing with other jobs that run at the same time.

Suggested change
- cron: '0 2 * * *' # Run daily at 2 AM UTC
- cron: '0 4 * * *' # Run daily at 2 AM UTC

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid supply chain attacks

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

uses: actions/checkout@v4

- name: Run backlog cleanup script
uses: actions/github-script@v7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid supply chain attacks

Suggested change
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending CLA ⚠️ Contributor is required to sign the CLA Status: Review needed Issue or PR is awaiting review Type: CI & Testing Related to continuous integration, automated testing, or test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants